var t, a = require("../../../@babel/runtime/helpers/defineProperty"), e = require("../../../utils/themeSkin/skinBehavior"), n = getApp();

Page({
    behaviors: [ e ],
    data: (t = {
        infoData: {},
        continue_days: "",
        sign_total: "",
        cumulative: "",
        sign_log: [],
        sign_name: "",
        integral: "",
        love_name: "",
        love_return: "",
        sign_model: {}
    }, a(t, "love_return", ""), a(t, "cumulative_point", ""), a(t, "cumulative_coupon", ""), 
    a(t, "cumulative_love", ""), a(t, "is_love", !1), a(t, "point", ""), a(t, "page", 1), 
    a(t, "total_page", 1), t),
    onLoad: function(t) {
        var a = "";
        try {
            a = wx.getStorageSync("integral");
        } catch (t) {
            console.log(t);
        }
        this.data.integral = a, this.setData({
            integral: a
        }), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.onfresh();
    },
    onShareAppMessage: function() {},
    getData: function() {
        var t = {
            page: this.data.page
        }, a = n.getNetAddresss("plugin.sign.Frontend.Modules.Sign.Controllers.sign-log.log"), e = this;
        n._getNetWork({
            url: a,
            data: t,
            success: function(t) {
                if (1 == t.data.result) {
                    var a = t.data.data, n = (t.data, t.data.data.sign_log.data);
                    n.forEach(function(t, a) {
                        t.award_content = e.data.integral + t.award_content.substr(2);
                    }), e.setData({
                        infoData: a,
                        love_return: a.love_return,
                        love_name: a.love_name,
                        sign_model: a.sign_model,
                        continue_days: a.continue_days,
                        sign_total: a.sign_total,
                        cumulative: e.data.integral + t.data.data.cumulative.substr(2),
                        sign_log: e.data.sign_log.concat(n),
                        total_page: a.sign_log.total,
                        sign_name: a.sign_name,
                        is_love: a.is_love,
                        cumulative_love: a.sign_model.cumulative_love,
                        cumulative_coupon: a.sign_model.cumulative_coupon,
                        cumulative_point: a.sign_model.cumulative_point,
                        point: wx.getStorageSync("integral")
                    }), wx.setNavigationBarColor({
                        frontColor: "#ffffff",
                        backgroundColor: e.data.themeBaseColor,
                        animation: {
                            duration: 400,
                            timingFunc: "easeIn"
                        }
                    }), wx.setNavigationBarTitle({
                        title: e.data.sign_name ? e.data.sign_name + "记录" : "记录"
                    }), e.data.page > a.sign_log.last_page && (e.setData({
                        page: a.sign_log.last_page
                    }), wx.showToast({
                        title: "没有更多数据了",
                        icon: "none"
                    }));
                }
            }
        });
    },
    onfresh: function() {
        wx.showLoading({
            title: "loading"
        }), console.log("下拉刷新"), this.setData({
            page: this.data.page + 1
        }), this.getData(), setTimeout(function() {
            wx.hideLoading();
        }, 1e3);
    }
});